package com.naml.h_objectstream;

import java.io.Serializable;

/**
 * @author marin
 * @version 1.0
 * @date 2025/4/24 20:27
 * @desc 用于序列化测试的类
 */

/**
 * 序列化：其实就是在保存数据的时，保存数据的值和数据类型。
 * 反序列化：其实就是在恢复数据的时候，恢复数据的值和数据类型。
 * 被static和transient修饰的属性是无法被序列化！！
 */

@SuppressWarnings("all")
public class Dog implements Serializable {

    private static final long serialVersionUID = 1L;

    private String name;
    private int age;
    private static String weight;
    private transient String color;

    public Dog(String name, int age, String weight, String color) {
        this.name = name;
        this.age = age;
        this.weight = weight;
        this.color = color;
    }

    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    @Override
    public String toString() {
        return "Dog:[name:"+this.name+",age:"+this.age+",weight:"+this.weight+",color:"+this.color+"]";
    }
}
